//
//  XIScene.h
//  XI Engine
//
//  Created by Balazs Faludi on 25.05.09.
//  Copyright 2009 Balazs Faludi. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "XIObject.h"

@class XILayer;

/** The XIScene object represents an independent piece of the game workflow, like the intro, the main menu, a level or the credits.
 You will probably spend most of your time creating subclasses of XIScene when working with XIEngine. An XIScene instance (hereinafter 
 referred to as scene) is responsible to draw it's fullscreen content to the screen when it is the active scene of the game.
 The active scene periodically receives an <code>update</code> and a <code>draw</code> message. Usually this happens 30 - 60 times a second.
 When you subclass XIScene you probably want to implement those two messages. In the <code>update</code> message which is received first,
 the scene moves it's objects (player, enemies, coins etc.), checks for events like deaths or hits and updates scores and other statistics.
 Right after it received the <code>update</code> message, the scene will receive a <code>draw</code> message. In this function it will draw
 it's objects, effects, HUD etc using OpenGL ES functions. In the default implementation, the scene doesn't draw it's objects itself, instead
 it will send a <code>draw:</code> message to all of it's object. The object's are then responsible to draw themself at their current location.
 The scene can also have objects that interact with eachother using real time physics. To enable physics you send a <code>enablePhysics</code>
 message to the scene and a <code>activatePhysics</code> message to any objects you want to add to the physics simulation. */
#if TARGET_OS_IPHONE
@interface XIScene : NSObject <UIAccelerometerDelegate>
#else
@interface XIScene : NSObject
#endif
{
	BOOL ignoresPause;
	
	//XIColor *backgroundColor;
	NSArray *layers;
	XILayer *mainLayer;
}

//@property (nonatomic, retain) XIGame *game;
@property (nonatomic) BOOL ignoresPause;
//@property (nonatomic, retain) XIColor *backgroundColor;
@property (nonatomic, retain) NSArray *layers;
@property (nonatomic, retain) XILayer *mainLayer;

- (id)initFromDictionary:(NSDictionary *)dict;
- (id)initWithXilName:(NSString *)xilName bundle:(NSBundle *)xilBundle;

- (void)willBecomeActiveScene;
- (void)didBecomeActiveScene;
- (void)willResignActiveScene;
- (void)didResignActiveScene;
#if TARGET_OS_IPHONE
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration;
#endif

#if TARGET_OS_IPHONE
- (void)update;
#endif
- (void)draw;

- (void)addLayer:(XILayer *)layer;
- (void)insertLayer:(XILayer *)layer atIndex:(int)index;
- (void)removeLayer:(XILayer *)layer;


@end
